# 定义一个Person类
class Person(object):
    #  人类
    def __init__(self,name,age):
        self.name = name
        self.age = age

    def __str__(self):
        return 'Pe'

#  创建两个Person
# p1 = Person('孙悟空',18)
# p2 = Person('猪八戒',28)

# 打印 p1
#  当我们打印一个对象时，实际上打印的是对象中的特殊方法__str__()的返回值
#  print(p1) # <__main__.Person....


#  object.__it__(self,other) <
#  object.__le__(self,other) <=
#  object.__eq__(self,other) =
#  object.__ne__(self,other) !=
#  object.__gt__(self,other) >
#  object.__ge__(self,other) >=
    def __repr__(self):
       return 'hello'
    
    def __bool__(self):
        return True
    def __get__(self,other):
        return self.age > other.age

p1 = Person('孙悟空',18)
p2 = Person('猪八戒',28)

if p1 :
    print(p1.name,'已经成年了！')
else :
    print(p1.name,'还未成年！')
print(p1.age <= p2.age)




